#ifndef _OHAI_WRITE_SELF_H_
#define _OHAI_WRITE_SELF_H_

/* Write to your own most recently active 'mesg y' terminal.
 *
 * Copyright 2008 Cian Synnott.
 * 
 * $Id: write_self.h 19 2009-11-27 20:46:48Z cian $
 */

/* Finds and writes to your most recently active 'mesg y' terminal.
 *
 * The text is written to your terminal unadorned, so any formatting you want
 * must be done beforehand.
 *
 * Args:
 * - text: string to write
 * Returns:
 * - integer 0 on success or -1 on failure
 * Side effects:
 * - logs error conditions on failure
 */
int write_self(const char *text);

/* Set the device prefix for ttys
 *
 * Defaults to /dev; this is exposed for testing.
 *
 * Args:
 * - prefix: string device prefix
 */
void set_device_prefix(char *prefix);

#endif /* _OHAI_WRITE_SELF_H_ */
